﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace SwInYUtility
{
    internal static class RemoveList
    {
        /// <summary>
        /// To hold all our Remove List Items
        /// </summary>
        private static List<string> _RemoveList = new List<string>();
        private static string _SaveLocation;

        internal static void Initialize()
        {
            _SaveLocation = LootFilter._FolderLocation + "\\RemoveList.txt";
            ReadFile();
        }

        /// <summary>
        /// Reads file and creates remove list
        /// </summary>
        private static void ReadFile()
        {
            // Error catch
            if (!File.Exists(_SaveLocation)) return;

            StreamReader Reader = new StreamReader(_SaveLocation);
            while (Reader.Peek() >= 0)
            {
                string ItemName = Reader.ReadLine().Trim();
                if (ItemName == "" || ItemName.Count() <= 1) continue;
                _RemoveList.Add(ItemName);
                Log.WriteDebug(Log.eLogType.LootFilter, "Adding Remove Item: {0}", ItemName);
            }

            Reader.Close();
        }
    }
}
